package biz.ezcom.design.pattern.memento;

public class Client {
	public static void main(String[] args) {
		//游戏状态
		State state = new State();
		state.setAttack(100);
		state.setDefense(100);
		state.setVitality(100);
		//开始游戏
		OriginatorGame game = new OriginatorGame();
		game.setState(state);//初始化状态
		
		game.show();//显示状态
		game.play();
		
		CareTaker careTaker = new CareTaker();
		Memento memento = game.saveMemento();//保存状态
		careTaker.setMemento(memento);
		game.play();
		game.play();
		game.show();
		
		game.loadMemento(careTaker.getMemento());//加载状态
		game.show();
	}
}
